package num0206;

/**
 * @author : DuJiabao
 * @Date : 2021/1/25 18:40
 * @Project : sword-finger-offer
 * @File : null.java
 * @Desc :
 */

import java.util.ArrayList;


class Solution {
    public boolean isPalindrome(ListNode head) {
        ListNode point = head;
        ArrayList<Integer> array = new ArrayList<>();
        while(point != null){
            array.add(point.val);
            point = point.next;
        }
        int length = array.size();
        for(int i=0;i<length/2;i++){
            if(!array.get(i).equals(array.get(length - 1 - i))) return false;
        }
        return true;
    }
}
